const sass = require('sass');

module.exports = grunt => {
  grunt.initConfig({
    clean: {
      temp: 'temp/**',
    },
    copy: {
      options: {},
      files: {
        'temp/public': ['src/assets/fonts', 'src/assets/images'],
      },
    },
    sass: {
      options:{
        sourceMap: true,
        implementation: sass
      },
      main: {
        files: {
          'temp/css/main.css': 'src/assets/styles/main.scss',
        }
      }
    },
    babel:{
      options:{
        presets:['@babel/preset-env']
      },
      main:{
        files: {
          'temp/js/app.js': 'src/assets/scripts/main.js',
        }
      }
    },
    watch:{
      js:{
        files: ['src/assets/scripts/*.js'],
        tasks:['babel']
      },
      css:{
        files: ['src/assets/styles/*.scss'],
        tasks:['sass']
      }

    }
  })
  grunt.loadNpmTasks('grunt-contrib-clean')
  grunt.loadNpmTasks('grunt-copy')
  grunt.loadNpmTasks('grunt-sass')
  grunt.loadNpmTasks('grunt-babel')
  grunt.loadNpmTasks('grunt-contrib-watch')


  grunt.registerTask('default', ['clean', 'copy', 'sass', 'babel', 'watch'])
}
